<template>
  <!-- <div id="app" v-bind:style="appDivStyle"> -->
  <!-- <div id="app" >
    <router-view></router-view>
  </div> -->
  <keep-alive>
    <component v-bind:is="currentComponent" v-bind="curProps" :ref="curComponentName"></component>
  </keep-alive>
</template>


<script>

import comBaseVue from '../../baseViewModel';
import AssetsAudit from './AssetsAudit';
import SubAssets from './SubAssets';


export default {
  mixins: [comBaseVue],
  name:'AssetsAuditFactory',
  props: {
    menuCode: String,
  },
  data () {
    
    return {
        currentComponent:AssetsAudit,
        curProps: {menuCode:this.menuCode},
        curComponentName:'AssetsAudit'
    }
  },
  methods:{
    setCurrentComponent:function(type,data){
      if(type=="AssetsAudit")
      {
         this.curProps = data;
         this.currentComponent = AssetsAudit;
         this.curComponentName = 'AssetsAudit';
      }
      else if(type=="SubAssets")
      {
         this.curProps = data;
         this.currentComponent = SubAssets;
         this.curComponentName = 'SubAssets';
      }
       else if(type=="goBack"){
        this.currentComponent = AssetsAudit;
        this.curComponentName = 'AssetsAudit';
      }
    },
    enterDown(){
      if(this.$refs[this.curComponentName]&&this.$refs[this.curComponentName].enterDown){
        this.$refs[this.curComponentName].enterDown()
      }
    }
  },
  mounted: function mounted() {
    // this.$router.push({ path: '/AssetsAudit' });//跳转到该路由
  }
}


</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
